package cn.itcast.interceptor;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配置拦截路径
 * 作用: 用户在未登录时不可进行其他业务操作*/
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new TokenIntector())
                //拦截所有请求路径
                .addPathPatterns("/**")
                //排除登录和验证码校验请求//"/pay/notify"
                .excludePathPatterns(new String[]{"/sms/sendLoginCode", "/member/login","/pay/notify"});
    }
}